package com.aaa.statistics.controller.api;

import com.aaa.entity.CheckItem;
import com.aaa.entity.CheckResult;
import com.aaa.statistics.feign.CheckItemFeign;
import com.aaa.statistics.service.CheckItemService;
import com.aaa.statistics.vo.CheckResultVo;
import com.aaa.vo.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("statistics/api/checkSts")
public class CheckItemController {

    @Resource
    private CheckItemFeign checkItemFeign;

    @Resource
    private CheckItemService checkItemService;
    /**
     * 调用接口 获取检查项目信息
     */
    @GetMapping("getItemName")
    public Result<List<CheckItem>> getCheckItemData(){
        List<CheckItem> itemNameList = checkItemFeign.getItemNameList();
        return new Result<>(200,"查询成功",itemNameList);
    }
    /**
     * 检查项目列表
     */
    @PostMapping("getCheckList")
    public Result<List<CheckResult>> getCheckList(@RequestBody CheckResultVo checkResultVo){
        return checkItemService.getCheckData(checkResultVo);
    }
    /**
     * 检查项目统计列表
     */
    @PostMapping("getCheckStatList")
    public Result<List<Map<String, Object>>> getCheckStatList(@RequestBody CheckResultVo checkResultVo){
        return checkItemService.getCheckStatData(checkResultVo);
    }
}
